from re import S, T
from numpy import square
from manimlib import *
#75cfb8
#bbdfc8
#f0e5d8
#ffc478
class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        frame = self.camera.frame
        self.play(frame.animate.set_width(18))
        x,y=5,5*np.sqrt(2)/2
        a,b,c,d=[-x,y,0],[x,y,0],[x,-y,0],[-x,-y,0]
        s=Polygon(a,b,c,d)
        c0=Circle(radius=y)
        c1=Arc(PI,PI,radius=x).shift(UP*y)
        c2=Arc(0,PI,radius=x).shift(DOWN*y)
        self.add(s,c0,c1,c2)
        #
        m,n=[-y,0,0],[y,0,0]
        arc1=Arc(1.25*PI,PI/2,radius=x).shift(UP*y).set_fill('#75cfb8',1)
        arc2=Arc(PI/4,PI/2,radius=x).shift(DOWN*y).set_fill('#75cfb8',1)
        brace=Brace(s,DOWN)
        tb=Tex('10').next_to(brace,DOWN)
        self.add(arc1,arc2,brace,tb,Tex('A').next_to(a,UL),Tex('B').next_to(b,UR),Tex('C').next_to(c,DR),Tex('D').next_to(d,DL),Tex('M').next_to(m,LEFT),Tex('N').next_to(n,RIGHT))
        self.add(Tex('?'))
        self.wait()
class p2(Scene):
    def construct(self):
        # self.add(NumberPlane())
        frame = self.camera.frame
        self.play(frame.animate.set_width(16))
        x,y=5,5*np.sqrt(2)/2
        a,b,c,d=[-x,y,0],[x,y,0],[x,-y,0],[-x,-y,0]
        s=Polygon(a,b,c,d)
        c0=Circle(radius=y)
        c1=Arc(PI,PI,radius=x).shift(UP*y)
        c2=Arc(0,PI,radius=x).shift(DOWN*y)
        self.add(s,c0,c1,c2)
        #
        m,n=[-y,0,0],[y,0,0]
        arc1=Arc(1.25*PI,PI/2,radius=x).shift(UP*y).set_fill('#75cfb8',1)
        arc2=Arc(PI/4,PI/2,radius=x).shift(DOWN*y).set_fill('#75cfb8',1)
        brace=Brace(s,DOWN)
        tb=Tex('10').next_to(brace,DOWN)
        self.add(arc1,arc2,brace,tb,Tex('A').next_to(a,UL),Tex('B').next_to(b,UR),Tex('C').next_to(c,DR),Tex('D').next_to(d,DL),Tex('M').next_to(m,LEFT),Tex('N').next_to(n,RIGHT))
        #
        o=[0,y,0]
        self.add(Tex('O').next_to(o,UP),Line(o,m),Line(o,n),Line(m,n))
        self.wait()